package com.yhsoft.upload.controller;

import com.yhsoft.common.vo.Result;
import com.yhsoft.upload.service.impl.FileService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author: yyyyyyyh
 * @create: 2023-10-12
 * @Version 1.0
 **/
@Api(tags = {"A-文件上传接口"})
@RestController
@RequestMapping("/OSSApi")
public class FileApiController {

    @Autowired
    private FileService fileService;

    //上传文件到阿里云oss
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file) {
        //获取上传文件
        String url = fileService.upload(file);
        return Result.success(url);
    }
}

